CDigitST v1.0
Copyright (C) 1998 by SoftechSoftware
Thank you for use this SoftechSoftware! Thanks very much!


Contact addresses

SoftechSoftware E-Mail:
davide_calabro@yahoo.com
SoftechSoftware homepage:
http://members.tripod.com/~SoftechSoftware/index.html
CDigitST homepage:
http://members.tripod.com/~SoftechSoftware/cdigit.html


Description

CDigitST is a class derived from MFC CStatic class.
This class easly lets put digital counters inside your applications!

CDigitST features:

You are encouraged to use this class everywhere you want; there is no fee required for CDigitST. Freely add modifications and/or fix bugs, but please, send any of these to SoftechSoftware!


How to integrate CDigitST in your application

    In your project include the following files:
    
        DigitST.h
        DigitST.cpp
    
    You also need a bitmap containing the actual digits. This bitmap must have
    the following format:
    - Each digit must have the same width and height
    - In the bitmap must be present 12 digits: 0..9 [blank] and [-]
      [blank] will be used for zeroes to the left
      [-] will be used as minus sign

    For example include in your project Small_1.bmp and call it IDB_SMALL1.
   
    With dialog editor create a static control called, for example, IDC_COUNTER
    and create a member variable for it:
    
        CDigitST m_dgtCounter;
    
    Now attach the static control to CDigitST. In your OnInitDialog procedure:
    
        // Call the base method
        CDialog::OnInitDialog();

        // Create the IDC_COUNTER digital counter
        m_dgtCounter.SubclassDlgItem(IDC_COUNTER, this);
    
    The control can display any number of digits you want (maximum is 10). Don't
    worry about the control dimensions since it will be resized at runtime depending
    on the precision (number of digits) you want.
    The control can be expanded/shrinked from left-to-right (or viceversa) and from
    top-to-bottom (or viceversa). See "CDigitST members" section for a detailed
    explanation of all possible resize values.

    Set resize direction to left-to-right and top-to-bottom:
    
        // Set resize direction
        m_dgtCounter.SetResize(CDigitST::ST_RIGHT | CDigitST::ST_BOTTOM);
    
    Now assign the bitmap to the control and set its precision:
    
        // Assign bitmap and precision
        m_dgtCounter.SetStyle(IDB_SMALL1, 5);    // The control will be automatically resized
    
    CDigitST has a default starting value of 0 (zero) but any value (in the range of signed integers) can
    be assigned to it:
    
        // Assign a starting value
        m_dgtCounter.SetValue(1000);
    
    By default the zeroes at the left of the value will be not displayed.
    This feature can be enabled/disabled at any time:
    
        // Enable zero padding
        m_dgtCounter.SetZeroPadding(TRUE);
    
    Your static control is now a CDigitST!

    Look inside the demo program to learn more about CDigitST. This is the best way!
    Also give a look to the included bitmaps to learn how to implement your own
    digital styles!



CDigitST members

BOOL SetStyle(UINT nBitmapId, int nPrecision);
Set digital style and precision (number of digits)
The control will be automatically resized

Input values: Return value:
Nonzero if successful; otherwise 0.

Example:
m_dgtCounter.SetStyle(IDB_SMALL1, 5);

void SetValue(int nValue, BOOL bRepaint = TRUE);
Set current digital counter value

Input values: Example:
m_dgtCounter.SetValue(1000);

int GetValue();
Get current digital counter value

Example:
int nCurrent = m_dgtCounter.GetValue();

void SetPrecision(int nPrecision, BOOL bResize = TRUE);
Set number of displayed digits (called precision)

Input values: Example:
m_dgtCounter.SetPrecision(5);

int GetPrecision();
Get number of displayed digits

Example:
int nPrecision = m_dgtCounter.GetPrecision();

void SetResize(DWORD dwResize, BOOL bResize = TRUE);
Set control resize direction

Input values: Example:
m_dgtCounter.SetResize(CDigitST::ST_LEFT | CDigitST::ST_TOP);

DWORD GetResize();
Get control resize direction

Example:
DWORD dwDirection = m_dgtCounter.GetResize();

void SetZeroPadding(BOOL bPad = FALSE, BOOL bRepaint = TRUE);
Enable/Disable showing zeroes at the left of the counter (called ZeroPadding)

Input values: Example:
m_dgtCounter.SetZeroPadding(TRUE);

BOOL GetZeroPadding();
Get ZeroPadding state

Example:
BOOL bPadding = m_dgtCounter.GetZeroPadding();

void Inc(BOOL bRepaint = TRUE);
Increment current digital counter value

Input values: Example:
m_dgtCounter.Inc();

void Dec(BOOL bRepaint = TRUE);
Decrement current digital counter value

Input values: Example:
m_dgtCounter.Dec();

static const short GetVersionI()
static const char* GetVersionC()

Return CDigitST version

Example:
int nVer = CDigitST::GetVersionI(); // Divide by 10 to get actual version
char szVer[20];
strcpy(szVer, CDigitST::GetVersionC());



History


Things to do


Copyright © 1998 by SoftechSoftware.
davide_calabro@yahoo.com